package com.wymobilearchitecture.heade_frist.state.state;

import com.wymobilearchitecture.heade_frist.state.CandyMachine;


/**
 * 没有硬币的状态
 * 执行没有硬币的逻辑
 */
public class NoQuarterStateItem implements State{

    private CandyMachine candyMachine;
    public NoQuarterStateItem(CandyMachine candyMachine){
        this.candyMachine = candyMachine;
    }

    @Override
    public void insertQuarter() {
        System.out.println("***投入了一个硬币");
        /**
         * 设置为有硬币状态
         */
        candyMachine.setState(candyMachine.hasQuarterStateItem);
    }

    @Override
    public void ejectQuarter() {
        System.out.println("没有硬币无法退币");
    }

    @Override
    public void dispense() {
        System.out.println("没有硬币无法出糖果");
    }
}
